!include "MUI2.nsh"

!define /date FILEDATE "%Y%m%d"
!define /date DATE "%Y.%m.%d"

Name "iNotes Notification"
OutFile "${FILEDATE}_iNotesNotification.exe"

InstallDir $PROGRAMFILES\iNotesNotification
InstallDirRegKey HKCU "Software\iNotesNotification" "Install_Dir"

RequestExecutionLevel highest

!define MUI_ABORTWARNING

;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE ".\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
 
!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Icon ..\src\iNotesNotification\Resources\NotNotes.ico
UninstallIcon ..\src\iNotesNotification\Resources\NotNotes.ico

Section "Install Program Files" install_section_id

	SetOutPath "$INSTDIR"

	File /oname=iNotesNotification.exe ..\src\iNotesNotification\bin\Release\iNotesNotification.exe
	File /oname=Interop.SHDocVw.dll ..\src\iNotesNotification\bin\Release\Interop.SHDocVw.dll
	File /oname=mail01.wav ..\sounds\mail01.wav
	File /oname=mail02.wav ..\sounds\mail02.wav
	File /oname=mail03.wav ..\sounds\mail03.wav
	File /oname=mail04.wav ..\sounds\mail04.wav
	File /oname=mail05.wav ..\sounds\mail05.wav

	WriteRegStr HKCU "Software\iNotesNotification" "" $INSTDIR

	WriteUninstaller "$INSTDIR\Uninstall.exe"
	
SectionEnd

Section "Start Menu Shortcuts" start_menu_section_id

	CreateDirectory "$SMPROGRAMS\iNotes Notification"
	CreateShortCut "$SMPROGRAMS\iNotes Notification\iNotes Notification.lnk" "$INSTDIR\iNotesNotification.exe" "" "$INSTDIR\iNotesNotification.exe" 0
	CreateShortCut "$SMPROGRAMS\iNotes Notification\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0

SectionEnd

;--------------------------------
;Descriptions

;Language strings
;LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
;!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
;!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
;!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

	Delete "$SMPROGRAMS\iNotes Notification\*.*"
	RMDir "$SMPROGRAMS\iNotes Notification"

	Delete $INSTDIR\*.exe
	Delete $INSTDIR\*.dll
	Delete "$INSTDIR\Uninstall.exe"

	RMDir "$INSTDIR"

	DeleteRegKey /ifempty HKCU "Software\iNotesNotification"

SectionEnd